package fire.gui;

import fire.Main;
import fire.room.Map;
import jgame.JGColor;
import jgame.JGObject;
import jgame.JGTimer;
import jgame.platform.JGEngine;

public class LoadingScreen extends JGObject {

	private String img;
	private int percent = 0;

	public LoadingScreen(String gfxname, int frames, final int i) {
		super("loading", true, 0, 0, 10001, null);
		img = gfxname;
		JGTimer a = new JGTimer(frames, true, this) {
			@Override
			public void alarm() {
				Main.setView(i);
				parent_obj.remove();
			}
		};
	}

	@Override
	public void paint(JGEngine g) {
		g.drawImage(-5000, -5000, img, null, 1, 0, 1.8, true);
		g.setColor(JGColor.white);
		g.drawRect(-5000, -5000, percent += 15, 20, true, false);
	}

}
